<?php

class User{
 	
	//Public members
	public $userId;
	public $UserName;
	public $PassWord;
	public $Email;
	public $Salt;
	public $IsAdmin;
	
	/**
	 * Function to create an instance of a user
	 * @access public
	 * @param UserID, UserName, Password, email, salt, isadmin
	 * @return UserObject
	 */
	public static function create($userId = 0, $UserName = "", $PassWord = "", $Email = "", $Salt = "", $IsAdmin = 0){
		$ret = new User();	
		$ret->userId = $userId;	
		$ret->UserName = $UserName;
		$ret->PassWord = $PassWord;
		$ret->Email = $Email;
		$ret->Salt = $Salt;
		$ret->IsAdmin = $IsAdmin;
		
		return $ret;
	}
	
	/**
	 * Function to convert from array to user
	 * @access public
	 * @param array with userinfo
	 * @return UserObject
	 */
	public static function convertFromArrayToUser($a_array){
		$ret = new User();	
		$ret->userId = $a_array['userId'];	
		$ret->UserName = $a_array['UserName'];
		$ret->PassWord = $a_array['PassWord'];
		$ret->Email = $a_array['Email'];
		$ret->Salt = $a_array['Salt'];
		$ret->IsAdmin = $a_array['IsAdmin'];
		
		return $ret;
	}
 }
